/**********************************
 *工具条事件
**********************************/

/**
* 增加公务
* @return
*/
function addGW(){
    var new_window = null;
     var newwin="/OrgUI/OrgUI_Addpub_config.jsp";
   new_window = window.open(newwin,'pass','width=450,height=400,resizable=1');
}

/**
* 删除公务
* @return
*/
function delGW(){
  var ls_t = GWForm.all("myTable")
  var pubCode = document.GWForm.pubCode;
  var submitflag;
  var pubCodeVal="";
  var rowcount = pubCode.length
  if(rowcount==undefined){
     if (pubCode.checked){
        if (pubCode.value == "new"){
          ls_t.deleteRow(2);
        }
        else {
          submitflag="y";
          pubCodeVal = pubCode.value + "$#$";
        }
      }
  }
  else{
    for (i=0;i<rowcount;i++){
      if (pubCode[i].checked){
        if (pubCode[i].value == "new"){
          ls_t.deleteRow(i+2);
          i = i - 1
          rowcount = rowcount - 1
        }
        else {
          submitflag="y";
          pubCodeVal = pubCodeVal + pubCode[i].value + "$#$";
        }
      }
    }
  }
  if(submitflag == "y"){
    document.GWForm.pubCodeVal.value=pubCodeVal;
    document.GWForm.action=delAction;
    document.GWForm.submit();
  }
}
/**
* 浏览公务配置
*/
function viewGW(){
 var pubCode = document.GWForm.pubCode;
 var gwFlag=true;
 var pubCodeVal="";
   if(pubCode.length==undefined){
      if (pubCode.checked){
        gwFlag=false;
        pubCodeVal=pubCode.value;
      }
   }
   else{
      for (i=0;i<pubCode.length;i++){
        if (pubCode[i].checked){
        gwFlag=false;
        pubCodeVal=pubCode[i].value;
       }
     }
   }
  if(gwFlag==true)
  {
    alert("请选择一条记录进行配置！");
    return;
  }
  document.GWForm.action="/OrgUI/OrgUI_pub_config.jsp?code="+pubCodeVal;
  document.GWForm.submit();
}
